{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Linear Equations\n", "The equations in the previous lab included one variable, for which you solved the equation to find its value. Now let's look at equations with multiple variables. For reasons that will become apparent, equations with two variables are known as linear equations.\n", "\n", "## Solving a Linear Equation\n", "Consider the following equation:\n", "\n", "\\begin{equation}2y + 3 = 3x - 1 \\end{equation}\n", "\n", "This equation includes two different variables, **x** and **y**. These variables depend on one another; the value of x is determined in part by the value of y and vice-versa; so we can't solve the equation and find absolute values for both x and y. However, we *can* solve the equation for one of the variables and obtain a result that describes a relative relationship between the variables.\n", "\n", "For example, let's solve this equation for y. First, we'll get rid of the constant on the right by adding 1 to both sides:\n", "\n", "\\begin{equation}2y + 4 = 3x \\end{equation}\n", "\n", "Then we'll use the same technique to move the constant on the left to the right to isolate the y term by subtracting 4 from both sides:\n", "\n", "\\begin{equation}2y = 3x - 4 \\end{equation}\n", "\n", "Now we can deal with the coefficient for y by dividing both sides by 2:\n", "\n", "\\begin{equation}y = \\frac{3x - 4}{2} \\end{equation}\n", "\n", "Our equation is now solved. We've isolated **y** and defined it as 3x-4/2\n", "\n", "While we can't express **y** as a particular value, we can calculate it for any value of **x**. For example, if **x** has a value of 6, then **y** can be calculated as:\n", "\n", "\\begin{equation}y = \\frac{3\\cdot6 - 4}{2} \\end{equation}\n", "\n", "This gives the result 14/2 which can be simplified to 7.\n", "\n", "You can view the values of **y** for a range of **x** values by applying the equation to them using the following Python code:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | x | \n", "y | \n", "
---|---|---|
0 | \n", "-10 | \n", "-17.0 | \n", "
1 | \n", "-9 | \n", "-15.5 | \n", "
2 | \n", "-8 | \n", "-14.0 | \n", "
3 | \n", "-7 | \n", "-12.5 | \n", "
4 | \n", "-6 | \n", "-11.0 | \n", "
5 | \n", "-5 | \n", "-9.5 | \n", "
6 | \n", "-4 | \n", "-8.0 | \n", "
7 | \n", "-3 | \n", "-6.5 | \n", "
8 | \n", "-2 | \n", "-5.0 | \n", "
9 | \n", "-1 | \n", "-3.5 | \n", "
10 | \n", "0 | \n", "-2.0 | \n", "
11 | \n", "1 | \n", "-0.5 | \n", "
12 | \n", "2 | \n", "1.0 | \n", "
13 | \n", "3 | \n", "2.5 | \n", "
14 | \n", "4 | \n", "4.0 | \n", "
15 | \n", "5 | \n", "5.5 | \n", "
16 | \n", "6 | \n", "7.0 | \n", "
17 | \n", "7 | \n", "8.5 | \n", "
18 | \n", "8 | \n", "10.0 | \n", "
19 | \n", "9 | \n", "11.5 | \n", "
20 | \n", "10 | \n", "13.0 | \n", "